import { init } from "./init.js";
import "./assetsLoader.js";
import Transaction from "https://cdn.jsdelivr.net/npm/@konghayao/promise-transaction/dist/promiseTransaction.browser.js";
import "./plugins/changeStates.js";
import View from "./Cuts/View.js";
import background from "./Cuts/background.js";
import Flower from "./Cuts/Flower.js";
import initIconEvent from "./Cuts/initIconEvent.js";
import initFirstEvent from "./Cuts/initFirstEvent.js";
import loadMusic from "./Music.js";
import Zoom from "./Zoom.js";
// 人物动画帧 https://juejin.cn/post/6844903764025933831

new Transaction(
    [
        ["init system config", () => init()],

        [
            "init Music",
            () => {
                return loadMusic();
            },
        ],
        [
            "init Background",
            () => {
                return background.run();
            },
        ],

        [
            "init Flower",
            () => {
                return Flower.run();
            },
        ],
        [
            "init System View",
            () => {
                return View.run();
            },
        ],
        ["init Zoom", () => (window.Zoom = Zoom)],
        [
            "init First Event",
            () => {
                return initFirstEvent.run();
            },
        ],
        [
            "init Icon Event",
            () => {
                return initIconEvent.run();
            },
        ],
        // [
        //     "create Spite2",
        //     (_, last) => {
        //         let sprite = new PIXI.AnimatedSprite(Resources["cat2"]);

        //         sprite.states = Resources["cat2"].states;
        //         sprite.changeStates("down");
        //         sprite.animationSpeed = 0.01;
        //         addAnime(sprite);
        //         sprite.play();
        //         window.demo = sprite;
        //         window.app.stage.addChild(sprite);
        //     },
        // ],
    ]
        .map((i) => {
            return [
                [Math.random(), () => console.group(i[0])],
                i,
                [Math.random(), () => console.groupEnd(i[0])],
            ];
        })
        .flat()
).run();
